<?php
/**
 * fldcms
 * ============================================================================
 * 版权所有 2017 福建华晟网络科技，并保留所有权利。
 * 网站地址: http://www.fldcms.cn
 * ----------------------------------------------------------------------------
 * 这不是一个自由软件！您只能在不用于商业目的的前提下对程序代码进行修改和使用 .
 * 不允许对程序代码以任何形式任何目的的再发布。
 * ============================================================================
 * Author: fld
 * Date: 2017-07-01
 */
namespace app\index\controller;

class ArticleController extends BaseController{
	/**
	 * 文章内容
	 */
	public function indexOp(){
		$id = input('param.id/d');
		if(empty($id)){
			$this->error('文章不存在');
		}else{
			/**文章信息**/
			$model_article = model('Article');
			$article_info = $model_article->getArticleInfo(array('id'=>$id,'is_show'=>1,'is_delete'=>0));
			if(empty($article_info)){
				$this->error('文章不存在');
			}else{
				$this->assign('article_info',$article_info);
				//获取表情
				$emote_list = model('emote')->getEmote();
				$this->assign('emote_list',$emote_list);
				//获取评论
				$comment_list = model('Comment')->getList("c.article_id=".$id." and c.status = 1 and c.type = 1 and c.is_del = 0 and pid = 0");
				$this->assign('comment_list',$comment_list);
				//获取评论条数
				$comment_count = model('Comment')->getCount("article_id=".$id." and status = 1 and type = 1 and is_del = 0 and pid = 0");
				$this->assign('comment_count',$comment_count);
				return $this->fetch();
			}
		}
	}
	
}